]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: use get_allocation_box() in _ensureIconVisible
authorDan Winship <danw@gnome.org>
Fri, 18 Mar 2011 18:33:45 +0000 (14:33 -0400)
committerDan Winship <danw@gnome.org>
Mon, 21 Mar 2011 18:26:07 +0000 (14:26 -0400)
When right-clicking on an AppWellIcon, the icon will become focused,
which (presumably via style-changed) invalidates its current
allocation, causing "icon.y" to return 0 until it has been
reallocated, messing up our idea of where in the AppDisplay the icon
is. Work around this by calling get_allocation_box() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=645162

js/ui/appDisplay.js

index 5017446ccc07f4609dd1ec30d2182ee6d0a168ae..bfe5ff70ad6effb30a663589c0ffd8393d0af02e 100644 (file)
@@ -86,10 +86,14 @@ AlphabeticalView.prototype = {
         if (vfade)
             offset = vfade.fade_offset;
 
-        if (icon.y < value + offset)
-            value = Math.max(0, icon.y - offset);
-        else if (icon.y + icon.height > value + pageSize - offset)
-            value = Math.min(upper, icon.y + icon.height + offset - pageSize);
+        // If this gets called as part of a right-click, the actor
+        // will be needs_allocation, and so "icon.y" would return 0
+        let box = icon.get_allocation_box();
+
+        if (box.y1 < value + offset)
+            value = Math.max(0, box.y1 - offset);
+        else if (box.y2 > value + pageSize - offset)
+            value = Math.min(upper, box.y2 + offset - pageSize);
         else
             return;